#ifndef SOUNDC
#define SOUNDC

#include "projet.h"
void init_sound()
{
         sounds[0]=FSOUND_Sample_Load(FSOUND_FREE, "son/1.wav", 0, 0, 0);
         if (!sounds[0]) allegro_message(" pas de son");
         sounds[1]=FSOUND_Sample_Load(FSOUND_FREE, "son/2.wav", 0, 0, 0);
         if (!sounds[1]) allegro_message(" pas de son");
         sounds[2]=FSOUND_Sample_Load(FSOUND_FREE, "son/3.wav", 0, 0, 0);
         if (!sounds[2]) allegro_message(" pas de son");
         sounds[3]=FSOUND_Sample_Load(FSOUND_FREE, "son/storm.wav", 0, 0, 0);
         if (!sounds[3]) allegro_message(" pas de son");
         sounds[4]=FSOUND_Sample_Load(FSOUND_FREE, "son/duck.wav", 0, 0, 0);
         if (!sounds[4]) allegro_message(" pas de son");
         sounds[5]=FSOUND_Sample_Load(FSOUND_FREE, "son/quack.wav", 0, 0, 0);
         if (!sounds[5]) allegro_message(" pas de son");
         sounds[6]=FSOUND_Sample_Load(FSOUND_FREE, "son/f_16.wav", 0, 0, 0);
         if (!sounds[6]) allegro_message(" pas de son");
         sounds[7]=FSOUND_Sample_Load(FSOUND_FREE, "son/jet.wav", 0, 0, 0);
         if (!sounds[7]) allegro_message(" pas de son");
         sounds[8]=FSOUND_Sample_Load(FSOUND_FREE, "son/seafury.wav", 0, 0, 0);
         if (!sounds[8]) allegro_message(" pas de son");
         
         FSOUND_Sample_SetDefaults(sounds[0],-1,volume_effet,-1,-1);
         FSOUND_Sample_SetDefaults(sounds[1],-1,volume_effet,-1,-1);
         FSOUND_Sample_SetDefaults(sounds[2],-1,volume_effet,-1,-1);
         FSOUND_Sample_SetDefaults(sounds[3],-1,volume_effet,-1,-1);
         FSOUND_Sample_SetDefaults(sounds[4],-1,volume_effet,-1,-1);
         FSOUND_Sample_SetDefaults(sounds[5],-1,volume_effet,-1,-1);
         FSOUND_Sample_SetDefaults(sounds[6],-1,volume_effet,-1,-1);
         FSOUND_Sample_SetDefaults(sounds[7],-1,volume_effet,-1,-1);
         FSOUND_Sample_SetDefaults(sounds[8],-1,volume_effet,-1,-1);
         
         
         boul_crash=0;
         boul_meteo=0;
         boul_moteur=0;
         
}



void play_crash(FSOUND_SAMPLE *s)
{
     FSOUND_StopSound(EFFET_CHANNEL);
     FSOUND_PlaySound(EFFET_CHANNEL,sounds[boul_crash%3]);
     boul_crash++;
}
void play_meteo(FSOUND_SAMPLE *s)
{
     FSOUND_StopSound(FSOUND_FREE);
     FSOUND_PlaySound(FSOUND_FREE,sounds[boul_meteo%3+3]);
     boul_meteo++;
}
void play_moteur(FSOUND_SAMPLE *s)
{
     FSOUND_StopSound(FSOUND_FREE);
     FSOUND_PlaySound(FSOUND_FREE,sounds[boul_moteur%3+6]);
     boul_moteur++;
}


#endif
